/**
 * TP GRUPO _ 
 * ALGORITMOS Y PROGRAMACION III
 */

package modelo;

/**
 * @author Grupo _
 */

public class FuncionIntegral extends FuncionParametrica{
	
	private double deltaX;
	private double xInicial;
	private double xFinal;
			     
			     
	private double area(Funcion funcion,double xInicial,double xFinal){
		double i=xInicial;
		double area=0;
        if (xInicial==xFinal) return 0;
		while (i<=xFinal){
			area+=deltaX*(Math.abs(funcion.calcular(i)));
			i+=deltaX;
		}
		return area;
	}

	public FuncionIntegral(Funcion funcion,double deltaX,double xInicial,double xFinal){
		this.setFuncion(funcion);
		this.deltaX=deltaX;
		this.xInicial=xInicial;
		this.xFinal=xFinal;
	}

	public double calcular(double x){
		return area(this.getFuncion(),xInicial,xFinal);
	}

}
      
